package com.dzl.goods;

import com.dzl.base.controller.BaseController;
import com.dzl.enterprise.pojo.query.WelfareEnterpriseApiGoodsQuery;
import com.dzl.enterprise.pojo.vo.WelfareEnterpriseApiGoodsBaseVo;
import com.dzl.enterprise.service.WelfareEnterpriseApiService;
import com.dzl.util.PageUtils;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 商品相关API控制层
 * @author liuguanjun
 * @date 2021-11-24 11:48:29
 */
@RestController
@RequestMapping("/goods")
public class WelfareGoodsController extends BaseController {

    @Autowired
    private WelfareEnterpriseApiService service;

    /**
     * 查询供应商商品数据列表，第三方接口调用
     * @author liuguanjun
     * @date 2021-11-24 15:44:30
     * @param query 查询条件
     **/
    @GetMapping("/getGoodsList")
    public PageUtils<WelfareEnterpriseApiGoodsBaseVo> getGoodsListPage(WelfareEnterpriseApiGoodsQuery query) {
        Integer enterpriseId = getWxUserInfo().getEnterpriseId();
        query.setEnterpriseId(enterpriseId);
        PageInfo<WelfareEnterpriseApiGoodsBaseVo> pageInfo = service.getWelfareEnterpriseApiGoodsListPage(query);
        return new PageUtils<>(pageInfo);
    }

}
